package cn.yunyichina.provider.base.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.yunyichina.provider.base.dao.EventDao;
import cn.yunyichina.provider.base.entity.Event;
import cn.yunyichina.utils.convert.JsonUtils;

/**
 * 
 * 系统日志
 */
@Service
public class EventServiceImpl {

	@Autowired
	private EventDao eventDao;
	
	private static Logger logger = LoggerFactory.getLogger(EventServiceImpl.class);
	
	/**
	 * yyt.base.event.get
	 * @param strJson
	 * @return
	 */
	public Event getEvent(String strJson) {

		List<Event> listEvent = this.selectEvent(strJson);
		if (listEvent != null && listEvent.size() > 0) {
			return listEvent.get(0);
		}
		return null;
	}
	
	/**
	 * yyt.base.event.select
	 * @param strJson
	 * @return
	 */
	public List<Event> selectEvent(String strJson) {
		logger.info(strJson);
		Event event = JsonUtils.parseObject(strJson, Event.class);
		return eventDao.select(event);
	}
	
}
